package com.mt.mall.entity.good;

import javax.persistence.*;
import java.io.Serializable;
import com.mt.common.core.annotation.DColumn;
import com.mt.common.core.annotation.DEntity;
import com.mt.common.core.web.base.BaseEntity;
import com.mt.mall.entity.merchant.Shop;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;



import com.mt.mall.entity.good.Commodity;

@DEntity(label="商品销售规格",comment="",moduleLabel="商品销售规格库存")
@Entity(name="mall_specification_stock")
@Table(name = "mall_specification_stock" , indexes = { @Index(name = "index_commodity_id", columnList = "commodity_id")  })
@ApiModel(description = "商品销售规格:")
public class SpecificationStock extends BaseEntity implements Serializable{
	private static final long serialVersionUID = 1L;

	@DColumn(index=3,label="商品",foreignEntity="Commodity",comment="商品",component="对象选择",where=true)
	@ApiModelProperty(value = "商品:商品")
	@Column(name="commodity_id",length=255,nullable=true,unique=false)
	private Long commodityId;

	@Transient
	private Commodity commodity;

	@Transient
	@ApiModelProperty(value = "商品名称:商品")
	@DColumn(index=3,label="商品",foreignEntity="Commodity",comment="商品")
	private String commodityName;
	@Transient
	@ApiModelProperty(value = "商品描述:商品")
	@DColumn(index=3,label="商品描述",foreignEntity="Commodity",comment="商品")
	private String commodityDescription;
	@DColumn(index=4,label="规格",comment="将所选择的规格用-拼接",component="文本",where=false)
	@ApiModelProperty(value = "规格:将所选择的规格用-拼接")
	@Column(name="specification",length=255,nullable=true,unique=false)
	private String specification;

	@DColumn(index=5,label="描述",comment="规格描述",component="文本",where=false)
	@ApiModelProperty(value = "描述:规格描述")
	@Column(name="stock",length=255,nullable=true,unique=false)
	private Integer stock;

	@DColumn(index=6,label="原价格",comment="原价格",component="文本",where=false)
	@ApiModelProperty(value = "原价格:原价格")
	@Column(name="old_price",length=255,nullable=true,unique=false)
	private Double oldPrice;

	@DColumn(index=7,label="价格",comment="价格",component="文本",where=false)
	@ApiModelProperty(value = "价格:价格")
	@Column(name="price",length=255,nullable=true,unique=false)
	private Double price;

	@DColumn(index=6,label="店铺",foreignEntity="Shop",comment="店铺信息",component="对象选择",where=true)
	@ApiModelProperty(value = "店铺:店铺信息")
	@Column(name="shop_id",length=255,nullable=false,unique=false)
	private Long shopId;

	@Transient
	private Shop shop;

	@Transient
	@ApiModelProperty(value = "店铺名称:店铺信息")
	@DColumn(index=6,label="店铺",foreignEntity="Shop",comment="店铺信息")
	private String shopName;

	public Long getShopId() {
		return shopId;
	}

	public void setShopId(Long shopId) {
		this.shopId = shopId;
	}

	public Shop getShop() {
		return shop;
	}

	public void setShop(Shop shop) {
		this.shop = shop;
	}

	public String getShopName() {
		return shopName;
	}

	public void setShopName(String shopName) {
		this.shopName = shopName;
	}

	public Double getOldPrice() {
		return oldPrice;
	}

	public void setOldPrice(Double oldPrice) {
		this.oldPrice = oldPrice;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public Long getCommodityId() {
		return this.commodityId;
	}

	public void setCommodityId(Long commodityId) {
		this.commodityId = commodityId;
	}

	public String getSpecification() {
		return this.specification;
	}

	public void setSpecification(String specification) {
		this.specification = specification;
	}

	public Integer getStock() {
		return this.stock;
	}

	public void setStock(Integer stock) {
		this.stock = stock;
	}

	public Commodity getCommodity() {
		return this.commodity;
	}

	public void setCommodity(Commodity commodity) {
		if(commodity == null){
		}
		else
		{
		this.commodityId = commodity.getEid();
		this.commodity = commodity;		
		}
}

	public String getCommodityName() {
		return this.commodityName;
	}

	public void setCommodityName(String commodityName) {
		this.commodityName = commodityName;
	}

	public String getCommodityDescription() {
		return commodityDescription;
	}

	public void setCommodityDescription(String commodityDescription) {
		this.commodityDescription = commodityDescription;
	}
}
